const { errorQuestionsModel } = require("../models/errorQuestionsModel");
const jwt = require("jsonwebtoken");
// 获取所有错题
async function getAllErrorQuestions(req, res, next){
    let {user_id}=req.query;
    let errorQuestions = await errorQuestionsModel.find({user_id}).populate("errorQuestions_id");
    // console.log(errorQuestions)
    res.send(errorQuestions)
}
// 标记为已学会
async function deleErrorQuestions(req, res, next){
    console.log(req.body._id);
    let result = await errorQuestionsModel.deleteMany({_id: req.body._id})
    console.log(result)
    if (result.deletedCount > 0) {
        res.send({ message: "删除成功", code: 200 })
    } else {
        res.send({ message: "删除失败", code: -1 })
    };
}
module.exports = {
    deleErrorQuestions,
    getAllErrorQuestions
}